/*
 * Created by JFormDesigner on Wed Jun 26 20:53:08 CST 2024
 */

package scct.ZhuZhouXing.ui;

import com.sun.org.apache.bcel.internal.generic.BREAKPOINT;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author xzy
 */
public class MainFrom extends JFrame {
    public MainFrom() {
        initComponents();
    }

    private void btnworker(ActionEvent e) {
        getStaff();
    }

    private void menStaff(ActionEvent e) {
        getStaff();
    }

    private void btncmm(ActionEvent e) {
        getProduct();
    }

    private void menGods(ActionEvent e) {
        getProduct();
    }

    private void btnmember(ActionEvent e) {
        getMembers();
    }

    private void menMebe(ActionEvent e) {
        getMembers();
    }

    private void menpage(ActionEvent e) {
        MainFrom main = new MainFrom();
        main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        main.setVisible(true);
        dispose();

    }

    private void menquit(ActionEvent e) {
        this.dispose();//退出关闭窗口
        LoginFrom loginFrom = new LoginFrom();
        loginFrom.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        loginFrom.setVisible(true);
    }

    //员工管理
    private void getStaff() {
        PaneStaffManager paneStaffManager = new PaneStaffManager(this);
        paneLMain.removeAll();
        paneLMain.add(paneStaffManager, BorderLayout.CENTER);
        validate();
    }

    //简略代码写方法调用
    //商品管理
    public void getProduct() {
        PaneProductManager paneProductManager = new PaneProductManager(this);
        paneLMain.removeAll();
        paneLMain.add(paneProductManager, BorderLayout.CENTER);
        validate();
    }

    //会员管理
    private void getMembers() {
        PaneMembersManager paneMembersManager = new PaneMembersManager(this);
        paneLMain.removeAll();
        paneLMain.add(paneMembersManager, BorderLayout.CENTER);
        validate();
    }


    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        // Generated using JFormDesigner Evaluation license - 老登
        menuBar1 = new JMenuBar();
        menu1 = new JMenu();
        menpage = new JMenuItem();
        menquit = new JMenuItem();
        menu4 = new JMenu();
        menGods = new JMenuItem();
        menStaff = new JMenuItem();
        menMebe = new JMenuItem();
        menu8 = new JMenu();
        menuItem5 = new JMenuItem();
        menuItem6 = new JMenuItem();
        pane = new JPanel();
        toolBar1 = new JToolBar();
        btnworker = new JButton();
        btnmember = new JButton();
        btncmm = new JButton();
        paneLMain = new JPanel();
        label1 = new JLabel();

        //======== this ========
        setTitle("\u8d85\u5e02\u7ba1\u7406\u7cfb\u7edf");
        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());

        //======== menuBar1 ========
        {

            //======== menu1 ========
            {
                menu1.setText("\u7cfb\u7edf");

                //---- menpage ----
                menpage.setText("\u9996\u9875");
                menpage.addActionListener(e -> menpage(e));
                menu1.add(menpage);

                //---- menquit ----
                menquit.setText("\u9000\u51fa\u8d26\u6237");
                menquit.addActionListener(e -> menquit(e));
                menu1.add(menquit);
            }
            menuBar1.add(menu1);

            //======== menu4 ========
            {
                menu4.setText("\u7ba1\u7406");

                //---- menGods ----
                menGods.setText("\u5546\u54c1\u7ba1\u7406");
                menGods.addActionListener(e -> menGods(e));
                menu4.add(menGods);

                //---- menStaff ----
                menStaff.setText("\u5458\u5de5\u7ba1\u7406");
                menStaff.addActionListener(e -> menStaff(e));
                menu4.add(menStaff);

                //---- menMebe ----
                menMebe.setText("\u4f1a\u5458\u7ba1\u7406");
                menMebe.addActionListener(e -> menMebe(e));
                menu4.add(menMebe);
            }
            menuBar1.add(menu4);

            //======== menu8 ========
            {
                menu8.setText("\u5173\u4e8e");

                //---- menuItem5 ----
                menuItem5.setText("\u5173\u4e8e\u6211\u4eec");
                menu8.add(menuItem5);

                //---- menuItem6 ----
                menuItem6.setText("\u9690\u79c1\u4e0e\u4fdd\u62a4\u534f\u8bae");
                menu8.add(menuItem6);
            }
            menuBar1.add(menu8);
        }
        setJMenuBar(menuBar1);

        //======== pane ========
        {
            pane.setBorder (new javax. swing. border. CompoundBorder( new javax .swing .border .TitledBorder (new javax
            . swing. border. EmptyBorder( 0, 0, 0, 0) , "JFor\u006dDesi\u0067ner \u0045valu\u0061tion", javax. swing
            . border. TitledBorder. CENTER, javax. swing. border. TitledBorder. BOTTOM, new java .awt .
            Font ("Dia\u006cog" ,java .awt .Font .BOLD ,12 ), java. awt. Color. red
            ) ,pane. getBorder( )) ); pane. addPropertyChangeListener (new java. beans. PropertyChangeListener( ){ @Override
            public void propertyChange (java .beans .PropertyChangeEvent e) {if ("bord\u0065r" .equals (e .getPropertyName (
            ) )) throw new RuntimeException( ); }} );
            pane.setLayout(new BorderLayout());

            //======== toolBar1 ========
            {
                toolBar1.setFloatable(false);

                //---- btnworker ----
                btnworker.setToolTipText("\u5458\u5de5\u7ba1\u7406");
                btnworker.setIcon(new ImageIcon(getClass().getResource("/icon/\u5458\u5de5.png")));
                btnworker.addActionListener(e -> btnworker(e));
                toolBar1.add(btnworker);

                //---- btnmember ----
                btnmember.setToolTipText("\u4f1a\u5458\u7ba1\u7406");
                btnmember.setIcon(new ImageIcon(getClass().getResource("/icon/\u4f1a\u5458.png")));
                btnmember.addActionListener(e -> btnmember(e));
                toolBar1.add(btnmember);

                //---- btncmm ----
                btncmm.setToolTipText("\u5546\u54c1\u7ba1\u7406");
                btncmm.setIcon(new ImageIcon(getClass().getResource("/icon/\u5546\u54c1.png")));
                btncmm.addActionListener(e -> btncmm(e));
                toolBar1.add(btncmm);
            }
            pane.add(toolBar1, BorderLayout.NORTH);

            //======== paneLMain ========
            {
                paneLMain.setLayout(new BorderLayout());

                //---- label1 ----
                label1.setText("Hi,\u4f60\u597d\uff01");
                label1.setHorizontalAlignment(SwingConstants.CENTER);
                label1.setFont(label1.getFont().deriveFont(label1.getFont().getStyle() | Font.BOLD, 80f));
                paneLMain.add(label1, BorderLayout.CENTER);
            }
            pane.add(paneLMain, BorderLayout.CENTER);
        }
        contentPane.add(pane, BorderLayout.CENTER);
        setSize(840, 625);
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    // Generated using JFormDesigner Evaluation license - 老登
    private JMenuBar menuBar1;
    private JMenu menu1;
    private JMenuItem menpage;
    private JMenuItem menquit;
    private JMenu menu4;
    private JMenuItem menGods;
    private JMenuItem menStaff;
    private JMenuItem menMebe;
    private JMenu menu8;
    private JMenuItem menuItem5;
    private JMenuItem menuItem6;
    private JPanel pane;
    private JToolBar toolBar1;
    private JButton btnworker;
    private JButton btnmember;
    private JButton btncmm;
    private JPanel paneLMain;
    private JLabel label1;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
